﻿/*******************************************************************************
 * Copyright © 2017 FriendStar.Framework 版权所有
 * Author: FZH
 * Description: FriendStar快速开发平台
 * Website：http://www.FriendStar.cn
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;
using FriendStar.Code;
using FriendStar.Domain.Entity.BOM;
using FriendStar.Domain.IRepository.BOM;
using FriendStar.Repository.BOM;

namespace FriendStar.Application.BOM
{
    /// <summary>
	/// 数据视图 V_LXK_16_LX_MakeLine 对应的数据应用功能类。
	/// </summary>
	public class V_LXK_16_LX_MakeLineApp
    {       
        private string UseUnit = Configs.GetValue("UseUnit");  

        private IV_LXK_16_LX_MakeLineRepository service = new V_LXK_16_LX_MakeLineRepository();

        public List<V_LXK_16_LX_MakeLineEntity> GetList(Pagination pagination, string MakeLineNO, string MakeLineName, string MakeExplain)
        {
            var expression = ExtLinq.True<V_LXK_16_LX_MakeLineEntity>();
            expression = expression.And(t => t.UseUnit == UseUnit);
            if (!string.IsNullOrEmpty(MakeLineNO))
            {
                expression = expression.And(t => t.MakeLineNO.Contains(MakeLineNO));
            }
            if (!string.IsNullOrEmpty(MakeLineName))
            {
                expression = expression.And(t => t.MakeLineName.Contains(MakeLineName));
            }
            if (!string.IsNullOrEmpty(MakeExplain))
            {
                expression = expression.And(t => t.MakeExplain.Contains(MakeExplain));
            }
            return service.FindList(expression, pagination);
        }

        public V_LXK_16_LX_MakeLineEntity GetForm(string keyValue)
        {
            var expression = ExtLinq.True<V_LXK_16_LX_MakeLineEntity>();
            expression = expression.And(t => t.MakeLineID == keyValue);
            return service.FindEntity(expression);
        }
    }
}